package top.starp.util;

import java.io.*;

public class IoUtil {

  public  static    void read(InputStream inputStream) throws IOException {
        InputStreamReader isr = new InputStreamReader(inputStream, "GB2312");
        BufferedReader br = new BufferedReader(isr);
//                BufferedReader 读出来是 中文乱码
        String line = null;
        while ((line = br.readLine()) != null) {
            System.out.println(line);
//            System.out.println(printType + ">" + line);
        }
    }

    public  static    String readRet(InputStream inputStream) throws IOException {
        InputStreamReader isr = new InputStreamReader(inputStream, "GB2312");
        BufferedReader br = new BufferedReader(isr);
//                BufferedReader 读出来是 中文乱码
        String line = null;
        StringBuilder res= new StringBuilder();
        while ((line = br.readLine()) != null) {
            System.out.println(line);
//            这都没有打印
            res.append(line).append("\n");
//            System.out.println(printType + ">" + line);
        }
        return res.toString();
    }
}
